/*
 * @Author: 贺楠 1071780426@qq.com
 * @Date: 2024-05-29 16:38:52
 * @LastEditors: 贺楠 1071780426@qq.com
 * @LastEditTime: 2024-08-08 11:22:34
 * @FilePath: \newMould_BHZ\src\components\TensionAndGrout\TensionManage\GroutManage\GroutRealTime\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import publicForm from "@/components/public/el-form.vue"; //弹框form
import CustomDialog from "@/components/stationProductionPage/GroutManage/GroutRealTime/processDetail/index.vue";
import TableData from "@/components/stationProductionPage/GroutManage/el-tables"; //主页面列表
import formJs from "./regexDetail.js"; //新增弹框配置项
import {
    statusTypes1
} from "@/utils/config"; //配置项
import {
    getGroutingProcess, //详情



} from "@/api/request.js";
export default {
    props: [
        "dialogVisible",
        "dialogTitle",
        "statusNum",
        "currentRow",
        "fCompanyid",
        "fCompanyname",
        "modelType", "getList"
    ],
    data() {
        return {
            WBSRow: {},
            WBSShow: false,

            visible: "",
            title: null,
            isLock: false,
            btnStatus: [],
            positionObj: [],
            dialogHeight: null,
            activeIndex: "1",

            tableData: [],

            currentDetail: null,
            fCompanynames: null,
            fCompanyids: null,
            processDetail: null,
            tableObj: formJs.tableObj,


        };
    },
    components: {
        publicForm,
        CustomDialog,

        TableData
    },
    watch: {
        dialogVisible: {
            handler(newVal) {
                if (newVal) {
                    this.visible = newVal;
                }
            },
            immediate: true,
        },
        dialogTitle: {
            handler(newVal) {
                if (newVal) {
                    this.title = newVal;
                }
            },
            immediate: true,
        },
        modelType: {
            handler(newVal) {
                if (newVal) {
                    this.modelTypes = newVal;
                }
            },
            immediate: true,
        },
        statusNum: {
            handler(newVal) {
                if (newVal) {


                    // this.edit(newVal);
                }

            },
            immediate: true,
        },

        currentRow: {
            handler(newVal) {
                if (newVal) {
                    this.currentDetail = newVal;
                    // fStatus
                    this.getDetail({
                        fCompanyid: this.currentDetail.fCompanyid,
                        beamId: this.currentDetail.fBeamid,
                    })


                }
            },

            immediate: true,
        },
        fCompanyid: {
            handler(newVal) {
                if (newVal) {

                    this.fCompanyids = newVal

                }
            },
            immediate: true,
        },
        fCompanyname: {
            handler(newVal) {
                if (newVal) {
                    this.fCompanynames = newVal

                }
            },
            immediate: true,
        },

    },
    created() {
        window.addEventListener("resize", this.getHeight);
        this.getHeight();
    }, //获取页面高度自适应：

    destroyed() {
        window.removeEventListener("resize", this.getHeight);
        this.getHeight();
    },
    mounted() {
        this.userInfo = JSON.parse(sessionStorage.getItem("yjSmart-userInfo"));
        this.btnShow = true
        this.getHeight();
        this.tableObj.thead[15]["callback"] = function (rowData) {
            let data = statusTypes1[rowData.fWarninglevel];
            if (data) {
                return data.label;
            }
        };
        this.tableObj.thead[15]["specialClass"] = function (rowData) {
            let data = statusTypes1[rowData.fWarninglevel];
            if (data) {
                return data.className;
            }
        };
    },
    methods: {
        // 点击当前行
        rowChange(val) {
            console.log(val);
            return val;
        },
        refreshList() {},
        WBSDialog() {
            this.WBSShow = false;
        },
        openDialog(row) {
            console.log(row);
            this.processDetail = row;
            this.WBSShow = true;

        },

        // 折叠面板
        changeCollapse(e) {
            console.log(this.activeNames, e);
        },
        getHeight() {
            var h = document.documentElement.clientHeight; //获取页面可见高度
            this.dialogHeight = h * 0.6 + "px";
        },
        handleSelect(key) {
            this.activeIndex = key;
        },
        closeDialog() {
            this.$emit("close");
        },


        // 详情
        getDetail(obj) {
            // var that = this
            this.loading = true;

            getGroutingProcess(obj).then((res) => {
                if (res.errcode == 0) {

                    this.loading = false;
                    this.tableData = res.data.groutingProcess;
                } else {
                    this.loading = false;
                }
            });
        },

    },
};